//
//  TCGuidangTool.m
//  陶瓷
//
//  Created by 王戈 on 15/8/2.
//  Copyright (c) 2015年 王戈. All rights reserved.
//

#import "TCGuidangTool.h"

@implementation TCGuidangTool

+ (void)writeObject:(id)object forFileName:(NSString *)fileName {
    NSString *docPath =  [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
    NSString *path = [docPath stringByAppendingPathComponent:fileName];
    [NSKeyedArchiver archiveRootObject:(NSArray *)object toFile:path];
}

+ (id)objectForFileName:(NSString *)fileName {
    NSString *docPath =  [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
    NSString *path = [docPath stringByAppendingPathComponent:fileName];
    
    return [NSKeyedUnarchiver unarchiveObjectWithFile:path];
}


@end
